<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>字典管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			$("#value").focus();
			layui.use(['laypage', 'form'], function(){
				form = layui.form; //只有执行了这一步，部分表单元素才会自动修饰成功
// 				form.verify({ //用作测试的layUI验证方式
// 					'value':[/^[\S]{6,12}$/,'666']
// 				})
				form.render();
			}); 
// 			$("#inputForm").validate({
// 				submitHandler: function(form){
// 					loading('正在提交，请稍等...');
// 					//form.submit();
// 				},
// 				errorContainer: "#messageBox",
// 				errorPlacement: function(error, element) {
// 					$("#messageBox").text("输入有误，请先更正。");
// 					if (element.is(":checkbox")||element.is(":radio")||element.parent().is(".input-append")){
// 						error.appendTo(element.parent().parent());
// 					} else {
// 						error.insertAfter(element);
// 					}
// 				}
// 			});
		});
	</script>
</head>
<body>
	<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
		<ul class="layui-tab-title">
		<li ><a href="${ctx}/sys/dict/">字典列表</a></li>
		<li class="layui-this">
			<a href="${ctx}/sys/dict/form?id=${dict.id}">字典
			<shiro:hasPermission name="sys:dict:edit">${not empty dict.id?'修改':'添加'}</shiro:hasPermission>
			<shiro:lacksPermission name="sys:dict:edit">查看</shiro:lacksPermission></a>
		</li>
	</ul></div>
	<form:form id="inputForm" modelAttribute="dict" action="${ctx}/sys/dict/save" method="post" class="layui-form">
		<form:hidden path="id"/>
		<div class="layui-form-item">
			<label class="layui-form-label">键值:</label>
			<div class="layui-input-inline">
				<input id="value" name="value" maxlength="50" type="text" class="layui-input" lay-verify="required"
				value="${dict.value}"/>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">标签:</label>
			<div class="layui-input-inline">
				<input name="label" maxlength="50" class="layui-input" lay-verify="required"
				value="${dict.label}"/>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">类型:</label>
			<div class="layui-input-inline">
				<input name="type" inputmaxlength="50" class=" layui-input" lay-verify="required"
				value="${dict.type}"/>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">描述:</label>
			<div class="layui-input-inline">
				<input name="description" inputmaxlength="50" class=" layui-input" lay-verify="required"
				value="${dict.description}"/>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">排序:</label>
			<div class="layui-input-inline">
				<input name="sort" inputmaxlength="11" class=" layui-input" lay-verify="required|number"
				value="${dict.sort}"/>
			</div>
		</div>
		<div class="layui-form-item">
			<label class="layui-form-label">备注:</label>
			<div class="layui-input-inline">
				<textarea name="remarks" inputrows="3" maxlength="200" class="layui-textarea">${dict.remarks}</textarea>
			</div>
		</div>
		<div class="layui-form-item">
			<div class="layui-input-block">
				<shiro:hasPermission name="sys:dict:edit">
					<input id="btnSubmit" lay-submit lay-filter="submit" class="layui-btn" type="submit" value="保 存" />&nbsp;</shiro:hasPermission>
				<input id="btnCancel" class="layui-btn layui-btn-primary"
					type="button" value="返 回" onclick="history.go(-1)" />
			</div>
		</div>
	</form:form>
</body>
</html>